//
//  huiyuanDetailsViewController.m
//  daogouApp
//
//  Created by panquanReabam.com on 15-6-2.
//  Copyright (c) 2015年 jiezsoft.com. All rights reserved.
//

#import "DeliveryConfirmTheOrderViewController.h"
#import "HttpRequest.h"
#import "JSONKit.h"
#import "HAODEsingleton.h"
#import "ProductView.h"
#import "UIViewExt.h"
#import "RDVTabBarController.h"
#import "MJRefresh.h"
#import "serviceCell.h"

#import "shangpingview.h"
#import "UIButton+WebCache.h"
#import "addhuiyuanlistViewController.h"
#import "AttributedLabel.h"
#import "huiyuandengjiViewController.h"
#import "ToResiduePayViewController.h"
#import "MembershipDetailsViewController.h"
#import "saoyisaoViewController.h"
#import "reasonTypeViewController.h"
@interface DeliveryConfirmTheOrderViewController ()<MBProgressHUDDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,UITextViewDelegate>
@property(nonatomic,strong)NSString*DocType;
@property(nonatomic,strong)NSString*sats;
@property (strong, nonatomic) NSString*GuideCode;

@end

@implementation DeliveryConfirmTheOrderViewController


{
    //    UIView*beizhuView;
    //    UILabel *line;
    //    UIScrollView*myscrollView;
    HAODEsingleton* commdity;
    //    UIImageView* imageview;
    //    UILabel *lineLabel1;
    //    ProductView *clothView;
    //    NSMutableArray*Memo;
    //    NSMutableArray*Integral;
    //    NSMutableArray*Amount;
    //    NSMutableArray*CreateDate;
    //    float lastContentOffset;
    //    UILabel *lineLabel111;
    //    UIButton*agreementBtn;
    //    UIButton*agreementBtn1;
    
    NSMutableArray*dealPrice;
    NSMutableArray*headImage;
    NSMutableArray*itemId;
    NSMutableArray*itemName;
    NSMutableArray*quantity;
    NSMutableArray*salePrice;
    NSMutableArray*specId;
    NSMutableArray* specName;
    NSMutableArray* specPrice;
    NSMutableArray* shopCartIds;
    NSMutableArray*isSelect;
    NSMutableArray*itemType;
    UIButton*hejibuyBtn1;
    
    UITextView* tv;
    UILabel * label;
    UIImageView*imagess;
    UIButton*buyBtn1;
    UIButton*buyBtn2;
    UITextField*xianjinTextFied;
    UITextField*fuwuTextFied;
    
    NSMutableArray *selectFeatureCodeArray;
    NSMutableArray *orderItemIds;
    NSMutableArray *selectimageArray;
    NSMutableArray *selectshuliangArray;
    NSMutableArray *selectduoshaoArray;
    NSMutableArray *keyishopCartIds;
    
    NSMutableArray *keyidealPrice;
    NSMutableArray *keyiitemCode;
    NSMutableArray *keyiitemName;
    NSMutableArray *keyiheadImage;
    NSMutableArray *keyispecName;
    NSMutableArray *keyiquantity;
    
    NSMutableArray *selectguigeArray;
    NSMutableArray *selectitemCodeArray;
    NSMutableArray * itemCode;
    
    
}
@synthesize alt = alt;
-(void)BackAction:(UIButton *)sender{
    
    
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [[self rdv_tabBarController] setTabBarHidden:YES];
        self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    
       UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.font=[UIFont systemFontOfSize:13];
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    self.navigationController.delegate = self;
    
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    
    commdity=[HAODEsingleton shared];
    
    
    
    self.title=@"配送确认";
    
    
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     [UIColor blackColor],
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];
   
    if ([commdity.xiangqing isEqualToString:@""]) {
        
        
        [self add];
  
        commdity.xiangqing=@"wu";

    }else {
        
        fuwuTextFied.text=commdity.content;
        
    }
      _table.separatorStyle=UITableViewCellSeparatorStyleNone;
    
    
}
-(void)add{
    
    
    dealPrice= [[NSMutableArray alloc] init];
    headImage= [[NSMutableArray alloc] init];
    itemId= [[NSMutableArray alloc] init];
    itemName= [[NSMutableArray alloc] init];
    quantity= [[NSMutableArray alloc] init];
    salePrice= [[NSMutableArray alloc] init];
    specId= [[NSMutableArray alloc] init];
    specName = [[NSMutableArray alloc] init];
    specPrice = [[NSMutableArray alloc] init];
    shopCartIds= [[NSMutableArray alloc] init];
    isSelect= [[NSMutableArray alloc] init];
    selectFeatureCodeArray=[[NSMutableArray alloc] init];
    selectimageArray=[[NSMutableArray alloc] init];
    selectshuliangArray=[[NSMutableArray alloc] init];
    selectduoshaoArray=[[NSMutableArray alloc] init];
    itemType=[[NSMutableArray alloc] init];
    selectguigeArray=[[NSMutableArray alloc] init];
    orderItemIds=[[NSMutableArray alloc] init];
    itemCode=[[NSMutableArray alloc] init];
    selectguigeArray=[[NSMutableArray alloc] init];
    selectitemCodeArray=[[NSMutableArray alloc] init];
    keyishopCartIds=[[NSMutableArray alloc] init];
    
    
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:commdity.orderId forKey:@"orderId"];
    
    
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    
    [HttpRequest requestData:@"Business/Order/Detail" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            NSLog(@"-----------%@", severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
                
                
                
                
                UIView* view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 620/2)];
                view.backgroundColor=zuiqianhuicolor;
                
                UIView* disev=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 40)];
                disev.backgroundColor=[UIColor whiteColor];
                disev.layer.borderColor = LineColor.CGColor;
                [disev.layer setBorderWidth:0.35];   //边
                [view addSubview:disev];
                
                UILabel* duogou=[[UILabel alloc]initWithFrame:CGRectMake(15, 25/2, 40, 15)];
                duogou.text=[NSString stringWithFormat:@"员工"];
                duogou.textColor=zhonghuiColor;
                duogou.font=[UIFont systemFontOfSize:15];
                [view addSubview:duogou];
                NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
                NSString* UserName = [user1 objectForKey:@"userName"];
                self.GuideCode = [user1 objectForKey:@"UserCode"];
                UIButton*daogouname=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-200,  25/2,180,15)];
                [daogouname setTitle:UserName forState:UIControlStateNormal];
                daogouname.titleLabel.font=[UIFont systemFontOfSize:15];
                daogouname.titleLabel.textAlignment=NSTextAlignmentRight;
                daogouname.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
                //[daogouname addTarget:self action:@selector(xuanzhidaogou:) forControlEvents:UIControlEventTouchUpInside];
                [daogouname setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
                [view addSubview:daogouname];
                
                
                
                
                UIView* view1=[[UIView alloc]initWithFrame:CGRectMake(0, 40+10, ScreenWidth, 70)];
                view1.backgroundColor=[UIColor whiteColor];
                view1.layer.borderColor = LineColor.CGColor;
                [view1.layer setBorderWidth:0.35];   //边
                [view addSubview:view1];
                NSString *s12 = [NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"order"] objectForKey:@"orderNo"]];
                UIFont *font12 = [UIFont systemFontOfSize:16];
                CGSize size12 = CGSizeMake(320, 2000);
                CGSize labelsize12 = [s12 sizeWithFont:font12 constrainedToSize:size12 lineBreakMode:NSLineBreakByCharWrapping];
                UILabel*source=[[UILabel alloc]initWithFrame:CGRectMake(15, 35/2, labelsize12.width, 16)];
                source.text=[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"order"] objectForKey:@"orderNo"]];
                source.textColor=[UIColor blackColor];
                source.font=[UIFont systemFontOfSize:16];
                [view1 addSubview:source];
                
                
                
                
                UILabel* duogous=[[UILabel alloc]initWithFrame:CGRectMake(15, 85/2, 33, 15)];
                duogous.text=[NSString stringWithFormat:@"来源"];
                duogous.textColor=zhonghuiColor;
                duogous.font=[UIFont systemFontOfSize:contenfot];
                [view1 addSubview:duogous];
                
                NSString *s1 = [NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"order"] objectForKey:@"source"]];
                UIFont *font1 = [UIFont systemFontOfSize:contenfot];
                CGSize size1 = CGSizeMake(320, 2000);
                CGSize labelsize1 = [s1 sizeWithFont:font1 constrainedToSize:size1 lineBreakMode:NSLineBreakByCharWrapping];
                
                daogouname=[[UIButton alloc]initWithFrame:CGRectMake(duogous.right,  85/2,labelsize1.width+5,15)];
                [daogouname setTitle:[NSString stringWithFormat:@"%@",   [[severDataDict.dataDict objectForKey:@"order"] objectForKey:@"source"]] forState:UIControlStateNormal];
                daogouname.titleLabel.font=[UIFont systemFontOfSize:contenfot];
                daogouname.titleLabel.textAlignment=NSTextAlignmentLeft;
                daogouname.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill;
                [daogouname setTitleColor:shenhuicolor forState:UIControlStateNormal];
                [view1 addSubview:daogouname];
                
                
                UILabel* orderDate=[[UILabel alloc]initWithFrame:CGRectMake(daogouname.right+10, 85/2, 60, 15)];
                orderDate.text=@"下单日期";
                orderDate.textColor=zhonghuiColor;
                orderDate.font=[UIFont systemFontOfSize:contenfot];
                [view1 addSubview:orderDate];
                NSRange range={0,10};
                NSString* string =[[[severDataDict.dataDict objectForKey:@"order"] objectForKey:@"orderDate"] substringWithRange:range];
                UILabel* orderDate1=[[UILabel alloc]initWithFrame:CGRectMake(orderDate.right, 85/2, 180, 15)];
                orderDate1.text=string;
                orderDate1.textColor=shenhuicolor;
                orderDate1.font=[UIFont systemFontOfSize:contenfot];
                [view1 addSubview:orderDate1];
                
                
                
        
                UIView*view2=[[UIView alloc]initWithFrame:CGRectMake(0, view1.bottom+10, ScreenWidth, 250/2)];
                view2.backgroundColor=[UIColor whiteColor];
                view2.layer.borderColor = LineColor.CGColor;
                [view2.layer setBorderWidth:0.35];   //边
                [view addSubview:view2];
                
                UIImageView *_xianview = [[UIImageView alloc]initWithFrame:CGRectMake(10,50-0.5, ScreenWidth-20, 0.5)];
                _xianview.image=[UIImage imageNamed:@"hengxian"];
                
                [view2 addSubview:_xianview];
                
                NSString *s = [NSString stringWithFormat:@"%@ ( %@ )",   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"memberName"],   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"phone"]];
                
                UIFont *font = [UIFont systemFontOfSize:16];
                CGSize size = CGSizeMake(320, 2000);
                CGSize labelsize = [s sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping];
                UILabel*huiyuanname=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, labelsize.width+3, 50)];
                huiyuanname.text=[NSString stringWithFormat:@"%@ ( %@ )",   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"memberName"],   [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"phone"]];
                huiyuanname.textColor=[UIColor blackColor];
                huiyuanname.font=[UIFont systemFontOfSize:16];
                [view2 addSubview:huiyuanname];
                
                UIImageView*Seximage=[[UIImageView alloc]initWithFrame:CGRectMake(huiyuanname.right, 15, 20, 20)];
                if (![[[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"sex"] isEqual:[NSNull null]]) {
                    
                    if ([[[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"sex"]isEqualToString:@"男"]) {
                        Seximage.image=[UIImage imageNamed:@"nan"];
                        
                        
                    }else{
                        Seximage.image=[UIImage imageNamed:@"nv"];
                    }
                    
                    
                }else{
                    Seximage.image=[UIImage imageNamed:@"nv"];
                    
                    
                }
                
                [view2 addSubview:Seximage];
                
                
                UILabel*jifen=[[UILabel alloc]init];
                jifen.text=[NSString stringWithFormat:@"%@", @"等级"];
                jifen.font=[UIFont systemFontOfSize:contenfot];
                jifen.textColor=zhonghuiColor;
                jifen.frame=CGRectMake(Seximage.right+10, 0, ScreenWidth*65/750, 50);
                [view2 addSubview:jifen];
                //
                
                commdity.memberId= [[severDataDict.dataDict objectForKey:@"member"] objectForKey:@"memberId"];
                

                
                UIButton*jiantou = [[UIButton alloc]init];
                jiantou.frame = CGRectMake(ScreenWidth-30,17.5,8, 13);
                [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
                [jiantou addTarget:self action:@selector(xiangqing:) forControlEvents:UIControlEventTouchUpInside];
                [view2 addSubview:jiantou];
                UIButton*jiadajiantou = [[UIButton alloc]init];
                jiadajiantou.frame = CGRectMake(ScreenWidth-100,0,100, 44);
                [jiadajiantou addTarget:self action:@selector(xiangqing:) forControlEvents:UIControlEventTouchUpInside];
                [view2 addSubview:jiadajiantou];
                

                
                
                

      
                
                
                
                UILabel*shouhuoren=[[UILabel alloc]init];
                shouhuoren.text=[NSString stringWithFormat:@"%@", @"收货人"];
                shouhuoren.font=[UIFont systemFontOfSize:contenfot];
                shouhuoren.textColor=zhonghuiColor;
                shouhuoren.frame=CGRectMake(15, _xianview.bottom+14,45,contenfot);
                [view2 addSubview:shouhuoren];
                
                
                NSString *ss = [[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"consignee"];
                UIFont *fonts = [UIFont systemFontOfSize:contenfot];
                CGSize sizes = CGSizeMake(320, 2000);
                CGSize labelsizes = [ss sizeWithFont:fonts constrainedToSize:sizes lineBreakMode:NSLineBreakByCharWrapping];
                
                UILabel*shouhuorenName=[[UILabel alloc]init];
                shouhuorenName.frame=CGRectMake(shouhuoren.right,  _xianview.bottom+14, labelsizes.width, contenfot);
                shouhuorenName.text= [[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"consignee"];
                shouhuorenName.font=[UIFont systemFontOfSize:contenfot];
                shouhuorenName.textColor=shenhuicolor;
                [view2 addSubview:shouhuorenName];
                
                UILabel*tel=[[UILabel alloc]init];
                
                tel.text=[NSString stringWithFormat:@"%@", @"电话"];
                tel.font=[UIFont systemFontOfSize:contenfot];
                tel.textColor=zhonghuiColor;
                tel.frame=CGRectMake(shouhuorenName.right+15, _xianview.bottom+14, 32.5, contenfot);
                [view2 addSubview:tel];
                //
                UILabel*telnumber=[[UILabel alloc]init];
                telnumber.text=[[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"phone"];
                telnumber.font=[UIFont systemFontOfSize:contenfot];
                telnumber.textColor=shenhuicolor;
                telnumber.frame=CGRectMake(tel.right,  _xianview.bottom+14, ScreenWidth*250/750, contenfot);
                [view2 addSubview:telnumber];
                
                
                
                NSString*address= [[severDataDict.dataDict objectForKey:@"send"] objectForKey:@"address"];
                
                NSString *addresStr =[NSString stringWithFormat:@"收货地址 %@",  address];
                UIFont *addressf = [UIFont systemFontOfSize:contenfot];
                CGSize sizeAddress = CGSizeMake(ScreenWidth-60, 2000);
                CGSize labelsizeAddress = [addresStr sizeWithFont:addressf constrainedToSize:sizeAddress lineBreakMode:NSLineBreakByCharWrapping];
                
                
                huiyuanname=[[UILabel alloc]initWithFrame:CGRectMake(15, shouhuoren.bottom+5, ScreenWidth-60, labelsizeAddress.height)];
                huiyuanname.text=[NSString stringWithFormat:@"收货地址 %@",  address];
                huiyuanname.textColor=shenhuicolor;
                huiyuanname.numberOfLines=2;
                huiyuanname.font=[UIFont systemFontOfSize:contenfot];
                
                NSMutableAttributedString *AttributedSt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"收货地址 %@",  address]];
                
                [AttributedSt addAttribute:NSFontAttributeName
                 
                                     value:[UIFont systemFontOfSize:contenfot]
                 
                                     range:NSMakeRange(0, 4)];
                
                [AttributedSt addAttribute:NSForegroundColorAttributeName
                 
                                     value:zhonghuiColor
                 
                                     range:NSMakeRange(0, 4)];
                
                
                huiyuanname.attributedText = AttributedSt;
                
                [view2 addSubview:huiyuanname];
                

                
                
                
                
                
                
                UIView* view3=[[UIView alloc]initWithFrame:CGRectMake(0, view2.bottom+10, ScreenWidth, 45)];
                view3.backgroundColor=[UIColor whiteColor];
                [view addSubview:view3];
                UILabel *lineLab=[[UILabel alloc] initWithFrame:CGRectMake(0,0, ScreenWidth, 0.35)];
                lineLab.backgroundColor=qianhuicolor;
                [view3 addSubview:lineLab];
                
                UILabel*shangpingxinxi=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, 80, 45)];
                shangpingxinxi.text=@"商品信息";
                shangpingxinxi.textColor=[UIColor blackColor];
                shangpingxinxi.font=[UIFont systemFontOfSize:15];
                [view3 addSubview:shangpingxinxi];
                
                UILabel *lineLabel13=[[UILabel alloc] initWithFrame:CGRectMake(15, 45-0.35, ScreenWidth-30, 0.35)];
                lineLabel13.backgroundColor=qianhuicolor;
                [view3 addSubview:lineLabel13];
                
       
                
                _table .tableHeaderView=view;
                
                
                
                
                NSMutableArray* arrr=[[NSMutableArray alloc]init];
                arrr=[severDataDict.dataDict objectForKey:@"orderItem"];
                
                if (arrr.count>0) {
                    
                    for (NSDictionary* dicc in arrr )
                    {
                        [dealPrice addObject:[dicc valueForKey:@"dealPrice"]];
                        [headImage addObject:[dicc valueForKey:@"headImageFull"]];
                        [itemId addObject:[dicc valueForKey:@"itemId"]];
                        [itemName addObject:[dicc valueForKey:@"itemName"]];
                        
                        [salePrice addObject:[dicc valueForKey:@"salePrice"]];
                        [specId addObject:[dicc valueForKey:@"specId"]];
                        [shopCartIds addObject:[dicc valueForKey:@"id"]];
                        [specName addObject:[dicc valueForKey:@"specName"]];
                        [specPrice addObject:[dicc valueForKey:@"specPrice"]];
                        [itemType addObject:[dicc valueForKey:@"itemType"]];
                        [itemCode addObject:[dicc valueForKey:@"itemCode"]];
                        
                        NSString*str=[NSString stringWithFormat:@"%d",  [[dicc valueForKey:@"quantity"]intValue]-[[dicc valueForKey:@"refundQuantity"]intValue]] ;
                        [quantity addObject:str];
                    }}
                
                
                
                
                [_table reloadData];
                
               NSString*totalMoney= [[severDataDict.dataDict objectForKey:@"order"] objectForKey:@"totalMoney"];
                NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
                [numberFormatter setPositiveFormat:@"###,##0.00;"];
                NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:totalMoney.doubleValue]];
                NSNumber *sum11 = [quantity valueForKeyPath:@"@sum.floatValue"];
               UILabel* weightke=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-250, 0, 230, 45)];
                weightke.text=[NSString  stringWithFormat:@"共 %@ 件,   ￥%@",sum11, formattedNumberString];
                weightke.textColor = [UIColor colorWithRed:5.00/255.0 green:18.0/255.0 blue:40.00/255.0 alpha:1];
                weightke.textAlignment = NSTextAlignmentRight;
                weightke.font = [UIFont systemFontOfSize:16];
                
                
                
                NSMutableAttributedString *AttributedStr2 = [[NSMutableAttributedString alloc]initWithString:[NSString  stringWithFormat:@"共 %@ 件,   ￥%@",sum11, formattedNumberString]];
                [AttributedStr2 addAttribute:NSFontAttributeName
                 
                                       value:[UIFont systemFontOfSize:13.0]
                 
                                       range:NSMakeRange(0, 8)];
                
                [AttributedStr2 addAttribute:NSForegroundColorAttributeName
                 
                                       value:zhonghuiColor
                 
                                       range:NSMakeRange(0, 8)];
                
                
                weightke.attributedText = AttributedStr2;
                [view3 addSubview:weightke];

                
                UIView*footview=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 300)];
                
                
                UIView* diseview=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 10)];
                diseview.backgroundColor=zuiqianhuicolor;
                [footview addSubview:diseview];
                UILabel *lineLabe0=[[UILabel alloc] initWithFrame:CGRectMake(0,0, ScreenWidth, 0.35)];
                lineLabe0.backgroundColor=qianhuicolor;
                [diseview addSubview:lineLabe0];
                UILabel *lineLabe9=[[UILabel alloc] initWithFrame:CGRectMake(0,10-0.35, ScreenWidth, 0.35)];
                lineLabe9.backgroundColor=qianhuicolor;
                [diseview addSubview:lineLabe9];
                UILabel* leixin=[[UILabel alloc]initWithFrame:CGRectMake(15, 10, 80, 50)];
                leixin.text=[NSString stringWithFormat:@"物流商"];
                leixin.textColor=shenhuicolor;
                leixin.font=[UIFont systemFontOfSize:15];
                [footview addSubview:leixin];
                
                fuwuTextFied=[[UITextField alloc]initWithFrame:CGRectMake(leixin.right,10, ScreenWidth*300/750,50)];
                fuwuTextFied.borderStyle = UITextBorderStyleNone;
                fuwuTextFied.keyboardType = UIKeyboardTypeDecimalPad;
                fuwuTextFied.font = [UIFont systemFontOfSize: 15];
                fuwuTextFied.textColor=[UIColor blackColor];
                fuwuTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
                fuwuTextFied.tag=6;
                fuwuTextFied.placeholder = @"请选择物流商"; //默认显示的字
                fuwuTextFied.delegate = self;
                //        [fuwuTextFied addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
                [fuwuTextFied setUserInteractionEnabled:NO];
                fuwuTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
                [footview addSubview:fuwuTextFied];
                UIButton*jiant = [[UIButton alloc] initWithFrame:CGRectMake(90,10,ScreenWidth, 50)];
                [jiant addTarget:self action:@selector(xuanzhidaogou:) forControlEvents:UIControlEventTouchUpInside];
                [footview addSubview:jiant];
                UIButton*jiantouBtn12 = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-30,27.5,8, 13)];
                [jiantouBtn12 setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
                [jiantouBtn12 addTarget:self action:@selector(xuanzhidaogou:) forControlEvents:UIControlEventTouchUpInside];
                [footview addSubview:jiantouBtn12];
                
                
                
                
                
//                UIView* diseview1=[[UIView alloc]initWithFrame:CGRectMake(0, 50, ScreenWidth, 10)];
//                diseview1.backgroundColor=zuiqianhuicolor;
//                [footview addSubview:diseview1];
//                UILabel *lineLabel11111=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 0.35)];
//                lineLabel11111.backgroundColor=qianhuicolor;
//                [diseview1 addSubview:lineLabel11111];
                UILabel *lineLabel11=[[UILabel alloc] initWithFrame:CGRectMake(15, 50+10, ScreenWidth-30, 0.35)];
                lineLabel11.backgroundColor=qianhuicolor;
                [footview addSubview:lineLabel11];
                
                UILabel* jine=[[UILabel alloc]initWithFrame:CGRectMake(15, lineLabel11.bottom, 80, 50)];
                jine.text=[NSString stringWithFormat:@"物流单号"];
                jine.textColor=shenhuicolor;
                jine.font=[UIFont systemFontOfSize:15];
                [footview addSubview:jine];
                
                xianjinTextFied=[[UITextField alloc]initWithFrame:CGRectMake(jine.right,lineLabel11.bottom, ScreenWidth*300/750,50)];
                xianjinTextFied.borderStyle = UITextBorderStyleNone;
                xianjinTextFied.keyboardType = UIKeyboardTypeDecimalPad;
                xianjinTextFied.font = [UIFont systemFontOfSize: 15];
                xianjinTextFied.textColor=[UIColor blackColor];
                xianjinTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
                xianjinTextFied.tag=6;
                xianjinTextFied.placeholder = @"请输入物流单号"; //默认显示的字
                xianjinTextFied.delegate = self;
                //                [xianjinTextFied addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
                [xianjinTextFied setUserInteractionEnabled:YES];
                xianjinTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
                [footview addSubview:xianjinTextFied];
                
                
                
                
                UIView* diseview2=[[UIView alloc]initWithFrame:CGRectMake(0, xianjinTextFied.bottom, ScreenWidth, 10)];
                diseview2.backgroundColor=zuiqianhuicolor;
                [footview addSubview:diseview2];
                
                UILabel *lineLab1=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 0.35)];
                lineLab1.backgroundColor=qianhuicolor;
                [diseview2 addSubview:lineLab1];
                UILabel *lineLab5=[[UILabel alloc] initWithFrame:CGRectMake(0, 10, ScreenWidth, 0.35)];
                lineLab5.backgroundColor=qianhuicolor;
                [diseview2 addSubview:lineLab5];
                
                
                UIView* myToolBar=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, viewheight)];
                myToolBar.backgroundColor=jianpancolor;
                UIButton*  tubtnDone=[[UIButton alloc]initWithFrame:CGRectMake(logoX,logoY, logoheight, logowidth)];
                [tubtnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
                [tubtnDone addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
                [myToolBar addSubview:tubtnDone];
                UIButton*btnDone111=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width - 55, 12, 40, 16)];
                [btnDone111 setTitle:@"确定" forState:UIControlStateNormal];
                [btnDone111 setTitleColor:jianpancolor1 forState:UIControlStateNormal];
                btnDone111 .titleLabel .font=[UIFont systemFontOfSize:daxiao];
                [btnDone111 addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
                [myToolBar addSubview:btnDone111];
                myToolBar.alpha=alp;
                UIButton* dabtn=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width-60, 0, 60, 40)];
                [dabtn addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
                [myToolBar addSubview:dabtn];
                
                
                tv=[[UITextView alloc]init];
                tv.frame=CGRectMake(15, diseview2.bottom+10, ScreenWidth-30, ScreenHeight*185/1334);
                tv.backgroundColor = [UIColor whiteColor];//设置它的背景颜色/Users/jiezsoft/Desktop/
                tv.scrollEnabled = YES;//是否可以拖动
                tv.delegate=self;
                //                tv.autoresizingMask = UIViewAutoresizingFlexibleHeight;//自适应高
                tv.font = [UIFont fontWithName:@"Arial" size:15.0];//设置字体名字和字体大小
                tv.layer.borderWidth =0;
                CGColorSpaceRef registedSpace11 = CGColorSpaceCreateDeviceRGB();
                CGColorRef tureBTncolorref111 = CGColorCreate(registedSpace11,(CGFloat[]){ 0, 0, 0, 0.3 });
                //                tv.keyboardType = UIKeyboardTypePhonePad;
                [tv.layer setBorderColor:tureBTncolorref111];//边框颜色
                tv.layer.cornerRadius =0;
                [footview addSubview:tv];
                imagess=[[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 20, 15)];
                imagess.image=[UIImage imageNamed:@"_0000_xingxifankui.png"];
                [tv addSubview:imagess];
                label=[[UILabel alloc]init];
                label.frame =CGRectMake(30, 5, ScreenWidth-60, 15);
                label.text = @"描述";
                label.textColor=zuiqianhuicolor;
                label.numberOfLines=0;
                label.font=[UIFont systemFontOfSize:15];
                label.enabled = NO;//lable必须设置为不可用
                label.backgroundColor = [UIColor clearColor];
                [tv addSubview:label];
                
                
                xianjinTextFied.inputAccessoryView = myToolBar;
                tv.inputAccessoryView = myToolBar;
                
                
                
                _table.tableFooterView=footview;
                
                
                
                [hejibuyBtn1 removeFromSuperview];
                
                
                hejibuyBtn1=[[UIButton alloc]initWithFrame:CGRectMake(0, ScreenHeight-45, ScreenWidth*430/750, 45)];
                [hejibuyBtn1 setTitle:[NSString stringWithFormat:@"已选商品%@件",@"0"] forState:UIControlStateNormal];
                hejibuyBtn1.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0];
                [hejibuyBtn1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                hejibuyBtn1.alpha=0.8;
                hejibuyBtn1.titleLabel.textAlignment=NSTextAlignmentLeft;
                hejibuyBtn1.titleLabel.font=[UIFont systemFontOfSize:titleNamefot];
                
                [self.view addSubview:hejibuyBtn1];
                
                
                buyBtn2=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth*430/750, ScreenHeight-45, ScreenWidth*320/750, 45)];
                [buyBtn2 setTitle:@"配送确认" forState:UIControlStateNormal];
                buyBtn2.backgroundColor=luseColor;
                [buyBtn2 addTarget:self action:@selector(queren:) forControlEvents:UIControlEventTouchUpInside];
                buyBtn2.titleLabel.font=[UIFont systemFontOfSize:titleNamefot];
                [buyBtn2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
                [self.view addSubview:buyBtn2];
                
                
                
                
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                // [Global showTextHud:requestResultStr view:self.view];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
    
    
    
    
    
}
-(void)saoyisao:(UIButton *)sender {
    
    commdity.sat=@"HUIyuan";
    saoyisaoViewController*de = [[saoyisaoViewController alloc] init];
    
    [self.navigationController pushViewController:de animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [itemId count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    serviceCell* cell = (serviceCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"serviceCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    UIButton*jiantou = [[UIButton alloc]init];
    jiantou.frame = CGRectMake(0,0, 8, 13);
    [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    
    //        cell.accessoryView = jiantou;
    //
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    cell.saveAccount=YES;
    
    
    [cell.imageview.layer setCornerRadius:5.0];
    [cell.imageview.layer setBorderWidth:0.3];
    [cell.imageview.layer setMasksToBounds:YES];
    CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
    CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){ 0, 0, 0, 0.3 });
    [cell.imageview.layer setBorderColor:colorref2];//边框颜色
    [cell.imageview setImageWithURL:[NSURL URLWithString:[headImage objectAtIndex:indexPath.row]] placeholderImage:[UIImage imageNamed:@""]];
    
    
    
    cell.shopCartId=[shopCartIds objectAtIndex:indexPath.row];
    
    cell.title.text =[NSString stringWithFormat:@"%@%@",[itemCode objectAtIndex:indexPath.row],[itemName objectAtIndex:indexPath.row]];
    
    cell.title.font=[UIFont systemFontOfSize:15];
    cell.title.textColor=[UIColor blackColor];
    
    cell.title.numberOfLines=2;
    
    if ([[specName objectAtIndex:indexPath.row]isEqualToString:@""]) {
        cell.guige.text =[NSString stringWithFormat:@"%@",@" "];
    }else{
        cell.guige.text =[NSString stringWithFormat:@"%@",[specName objectAtIndex:indexPath.row]];}
    cell.guige.font=[UIFont systemFontOfSize:contenfot];
    cell.guige.textColor=zhonghuiColor;
    
    
    
    cell.shuliang.text =[NSString stringWithFormat:@"%.f",  [[quantity objectAtIndex:indexPath.row]floatValue]];
    cell.shuliang.font=[UIFont systemFontOfSize:contenfot];
    
    NSString*GoldPrice=[NSString stringWithFormat:@"%@",[dealPrice objectAtIndex:indexPath.row]];
    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
    [numberFormatter setPositiveFormat:@"###,##0.00;"];
    NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:GoldPrice.floatValue]];
    cell.jiage.text =[NSString stringWithFormat:@"￥%@",  formattedNumberString];
    cell.jiage.font=[UIFont systemFontOfSize:18];
    cell.jiage.textColor=hongsecolor;
    NSMutableAttributedString *AttributedSt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"￥%@",  formattedNumberString]];
    
    [AttributedSt addAttribute:NSFontAttributeName
     
                         value:[UIFont systemFontOfSize:15]
     
                         range:NSMakeRange(0, 1)];
    
    [AttributedSt addAttribute:NSForegroundColorAttributeName
     
                         value:hongsecolor
     
                         range:NSMakeRange(0, 1)];
    
    
    cell.jiage.attributedText = AttributedSt;

  
    cell.xiugaijiage=[NSString stringWithFormat:@"%@",[dealPrice objectAtIndex:indexPath.row]];
    
    if  ([orderItemIds containsObject:[shopCartIds objectAtIndex:indexPath.row]]){
        
        
        cell.xuanzeimage.image=[UIImage imageNamed:@"gous"];
        cell.saveAccount=NO;
        
    }
    
    
    
    
    if (itemId.count !=indexPath.row+1) {
        UILabel *lineLabel31=[[UILabel alloc] initWithFrame:CGRectMake(15, 120-0.35, ScreenWidth-30, 0.35)];
        lineLabel31.backgroundColor=qianhuicolor;
        [cell.contentView addSubview:lineLabel31];
        
    }
    
    if (itemId.count ==indexPath.row+1) {
        UILabel *lineLabel31=[[UILabel alloc] initWithFrame:CGRectMake(0, 120-0.35, ScreenWidth, 0.35)];
        lineLabel31.backgroundColor=qianhuicolor;
        [cell.contentView addSubview:lineLabel31];
        
    }
    
    
    
    
    
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    
    if (tableView ==_table) {
        
        UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
        serviceCell *sharecell=(serviceCell *)cell;
        sharecell.saveAccount=! sharecell.saveAccount;
        
        if (!sharecell.saveAccount) {
            
            
            
            [selectFeatureCodeArray addObject:[NSString stringWithFormat:@"%@",[itemName objectAtIndex:indexPath.row]]];
            [selectimageArray addObject:[headImage objectAtIndex:indexPath.row]];
            [selectshuliangArray addObject:[quantity objectAtIndex:indexPath.row]];
            [selectduoshaoArray addObject:[NSString stringWithFormat:@"%@",[dealPrice objectAtIndex:indexPath.row]]];
            [selectguigeArray addObject:[specName objectAtIndex:indexPath.row]];
            [selectitemCodeArray addObject:[itemCode objectAtIndex:indexPath.row]];
            [orderItemIds addObject:[shopCartIds objectAtIndex:indexPath.row]];
            
            UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
            serviceCell *sharecell=(serviceCell *)cell;
            sharecell.xuanzeimage.image=[UIImage imageNamed:@"gous"];
            
            
            
            
        }
        else{
            UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
            serviceCell *sharecell=(serviceCell *)cell;
            
            sharecell.xuanzeimage.image=[UIImage imageNamed:@"quans"];
            if (selectFeatureCodeArray.count>0) {
                
                for (int i=0; i<selectFeatureCodeArray.count; i++) {
                    
                    NSString *codeStr = [selectFeatureCodeArray objectAtIndex:i];
                    if ([codeStr isEqualToString:[NSString stringWithFormat:@"%@",[itemName objectAtIndex:indexPath.row]]] ) {
                        
                        [selectguigeArray removeObjectAtIndex:i];//从指定索引移除
                        [orderItemIds removeObjectAtIndex:i];//从指定索引移除
                        [selectFeatureCodeArray removeObjectAtIndex:i];//从指定索引移除
                        [selectimageArray removeObjectAtIndex:i];//从指定索引移除
                        [selectshuliangArray removeObjectAtIndex:i];//从指定索引移除
                        [selectduoshaoArray removeObjectAtIndex:i];//从指定索引移除
                        [selectitemCodeArray removeObjectAtIndex:i];//从指定索引移除
                    }
                }
            }
        }
        
        
        NSNumber *sum11 = [selectshuliangArray valueForKeyPath:@"@sum.floatValue"];
        [hejibuyBtn1 setTitle:[NSString stringWithFormat:@"已选商品%@件",sum11] forState:UIControlStateNormal];
        NSLog(@"--＝＝＝＝＝＝-------%@",selectFeatureCodeArray);
    }
}
#pragma mark - Table view delegate


- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    return  120;
    
}

#pragma mark - Table view delegate




-(void)queren:(UIButton*)sender{
    NSLog(@"%@",self.DocType);
    
    if (orderItemIds.count >0 )
    {
        //        [self showAlertMessage:@"请选择物流商"];
        //    }
        //    else{
        //
        //        if ([xianjinTextFied.text length] <1)
        //        {
        //            [self showAlertMessage:@"请输入物流单号"];
        //        }
        //        else{
        
        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        NSMutableDictionary *params = [NSMutableDictionary new];
        [params setValue:Token forKey:@"tokenId"];
        [params setValue:commdity.code forKey:@"serviceTypeCode"];
        
        
        [params setValue:tv.text forKey:@"predictDesc"];
        [params setValue:commdity.orderId forKey:@"orderId"];
        [params setValue:commdity.content forKey:@"expressCompany"];
        [params setValue:xianjinTextFied.text forKey:@"expressNumber"];
        [params setValue:@"" forKey:@"courier"];
        //            NSMutableArray *mDocumentLine=[NSMutableArray array];
        //
        //
        //            for (int i=0; i<orderItemIds.count; i++) {
        //
        //                NSMutableDictionary *dic = [NSMutableDictionary dictionary];
        //                NSString *itemIdstr = [orderItemIds objectAtIndex:i];
        //                NSString *quantitystr =[selectshuliangArray objectAtIndex:i];
        //                [dic setValue:quantitystr forKey:@"quantity"];
        //                [dic setValue:itemIdstr forKey:@"oItemId"];
        //                [mDocumentLine addObject:dic];
        //
        //
        //            }
        [params setValue:orderItemIds  forKey:@"orderItemIds"];
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
        
        
        [HttpRequest requestData:@"Business/Order/DeliveryConfirm" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
                
                NSLog(@"%@",severDataDict.dataDict);
                
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];
                    
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    // [Global showTextHud:requestResultStr view:self.view];
                    [Global showTextHudSub:requestResultStr view:self.view];
                    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
                    
                    
                    
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    // [Global showTextHud:requestResultStr view:self.view];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];
        
        
    }else{
        [self showAlertMessage:@"请选择商品！"];
        
        
    }
    
}



-(void)xuanzhidaogou:(id)sender
{
    
    reasonTypeViewController *detailViewController = [[reasonTypeViewController alloc] init];
    detailViewController.optionName=@"ExpressCompany";
    detailViewController.titlename=@"选择物流商";
    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
}
-(void)xiangqing:(UIButton*)sender{
    
    
    //    commdity.xiangqing=@"wu";
    //    commdity.gengxin=@"";
    //    huiyuanDetailsViewController *detailViewController = [[huiyuanDetailsViewController alloc] init];
    //
    //    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
    commdity.gengxin=@"";
    MembershipDetailsViewController *detailViewController = [[MembershipDetailsViewController alloc] init];
    [self.navigationController pushViewController:detailViewController animated:YES];
    //    huiyuanDetailsViewController *detailViewController = [[huiyuanDetailsViewController alloc] init];
    //
    //    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
    
    
}
- (void)textFieldDidBeginEditing:(UITextField *)textField{
    
    if (textField.tag == 6)
    {
        
        [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
        _table .frame =CGRectMake(0, -200, ScreenWidth, ScreenHeight);
        [UIView commitAnimations];
        
        
    }
    
}
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    _table .frame =CGRectMake(0, -250, ScreenWidth, ScreenHeight);
    [UIView commitAnimations];
    
    
    
    return self;
}



//回收键盘
-(void)OnTapDone{
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    _table .frame =CGRectMake(0, 0, ScreenWidth, ScreenHeight);
    [UIView commitAnimations];
    
    [xianjinTextFied resignFirstResponder];
    [tv resignFirstResponder];
//    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
//    [numberFormatter setPositiveFormat:@"###,##0.00;"];
//    NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:xianjinTextFied.text.doubleValue]];
//    
//    [hejibuyBtn1 setTitle:[NSString stringWithFormat:@"合计￥%@",formattedNumberString] forState:UIControlStateNormal];
    
    
}
-(void)closeKeyBoad
{
//    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
//    [numberFormatter setPositiveFormat:@"###,##0.00;"];
//    NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:xianjinTextFied.text.doubleValue]];
//    
//    
//    [hejibuyBtn1 setTitle:[NSString stringWithFormat:@"合计￥%@",formattedNumberString] forState:UIControlStateNormal];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    _table .frame =CGRectMake(0, 0, ScreenWidth, ScreenHeight);
    [UIView commitAnimations];
    
    [xianjinTextFied resignFirstResponder];
    [tv resignFirstResponder];
}



- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}
-(void)textViewDidChange:(UITextView *)textView
{
    //self.examineText =  textView.text;
    
    
    if (textView.text.length == 0) {
        [imagess removeFromSuperview];
        
        imagess=[[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 51/3, 51/3)];
        imagess.image=[UIImage imageNamed:@"_0000_xingxifankui.png"];
        [tv addSubview:imagess];
        label.text = @"描述";
        
    }else{
        [imagess removeFromSuperview];
        label.text = @"";
    }
}







@end
